/**
 * Copyright 2008-2009. Chongqing Communications Industry Services Co.,Ltd Information Technology Branch. All rights
 * reserved. <a>http://www.cqcis.com</a>
 */
package com.cqcis.uip.base.framework.core.cluster;

import com.cqcis.uip.base.framework.core.cluster.ClusterSupportSelector.StubState;
import com.cqcis.uip.base.framework.core.cluster.ClusterSupportSelector.SwitchInfo;
import com.cqcis.uip.base.framework.core.cluster.ClusterSupportSelector.TelnetSwitchHttpProctolStub;
import com.cqcis.uip.base.framework.utils.StringUtil;

/**
 * @author huangmy
 * @date 2009-1-6
 */
public class ClusterStub {
	private SwitchInfo si; // info
	private StubState state = StubState.DEACTIVE; // 是否是新建， 对于新建stub,
													// 会先执行登录和集群建立操作
	private String stateNode;
	private long id;
	private TelnetSwitchHttpProctolStub stub;

	public ClusterStub(TelnetSwitchHttpProctolStub stub) {
		this.si = stub.si;
		this.state = stub.state;
		this.stateNode = stub.stateNode;
		this.id = stub.id;
		this.stub = stub;
	}

	public SwitchInfo getSi() {
		return si;
	}
	
	public String getSiKey () {
		return si.getDesc();
	}

	public StubState getState() {
		return state;
	}

	public String getStateNode() {
		return StringUtil.hasText(stateNode) ? stateNode : "";
	}

	public long getId() {
		return id;
	}

	public TelnetSwitchHttpProctolStub getStub() {
		return stub;
	}
}
